/*
 * Example usage of the tuple utilities pop and shift in cxxomfort.
 *
 * This and other examples assume cxxomfort is installed in
 * include library path; if otherwise, adjust with
 * -I /path/to/cxxomfort .
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/tuple.hpp>
#include <cxxomfort/library/tuple.hpp>
#include <cxxomfort/library/type_name.hpp>
#include <cxxomfort/ostream.hpp>
#include <string>
#include <ctime>
#include <iostream>
#include <cassert>


#define CXXO_R(...) #__VA_ARGS__

namespace cxlt= cxxomfort::library::tuple;
using cxxomfort::library::type_name;

int main () {
	using namespace std; 
	cxxomfort::output_info(stdout);
	cout<< endl;
	cout<< CXXO_R(
Demoing cxxomfort library tuple: tuple_pop, tuple_shift
\n----
)<< endl;
	CXXO_AUTO_OR(t , (make_tuple (2.2, string("Hello World"), time(0), string_view(__FILE__) ) ), (tuple<float,string,time_t,string_view>));
	cout<< "t   : "<< get<0>(t)<< " , "<< get<1>(t)<< " , "<< get<2>(t)<< " , "<< get<3>(t)<< endl;
	cout<< type_name< CXXO_TYPEOF(t) >()<< endl;
	CXXO_AUTO(tp2 , cxlt::tuple_pop(t) );
	cout<< "tp2 : "<< get<1>(tp2)<< " , "<< get<2>(tp2)<< endl;
	cout<< type_name< CXXO_TYPEOF(tp2) >()<< endl;
	CXXO_AUTO(ts2 , cxlt::tuple_shift(t) );
	cout<< "ts2 : "<< get<1>(ts2)<< " , "<< get<2>(ts2)<< endl;
	cout<< type_name< CXXO_TYPEOF(ts2) >()<< endl;
	cout<< endl;

	CXXO_AUTO(tp2s3 , cxlt::tuple_shift(tp2) );
	cout<< get<0>(tp2s3)<< endl;
	cout<< type_name< CXXO_TYPEOF(tp2s3) >()<< endl;

	CXXO_AUTO(ts2p3 , cxlt::tuple_pop(ts2) );
	cout<< get<0>(ts2p3)<< endl;
	cout<< type_name< CXXO_TYPEOF(ts2p3) >()<< endl;
	
}
